FROM java:8u111-jre-alpine
MAINTAINER mjy "1808330523@qq.com"

ARG CAMPUS_CARD_VERSION=2.0
ARG CAMPUS_CARD_SERVICE_DIR="ManagerBackStageService2"
ARG CAMPUS_CARD_SERVICE_PACKAGE="ManagerBackStageService-$CAMPUS_CARD_VERSION-SNAPSHOT.jar"
ARG CAMPUS_CARD_SERVICE_PROGRAM="campus-ManagerBackStage2-2.0-SNAPSHOT.jar"

# set environment
ENV BASE_DIR="/home/campus_card/${CAMPUS_CARD_SERVICE_DIR}" \
    CLASSPATH=".:/home/campus_card/${CAMPUS_CARD_SERVICE_DIR}/conf:$CLASSPATH" \
    JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" \
    JAVA="/usr/lib/jvm/java-8-openjdk-amd64/bin/java" \
    JAVA_OPT_EXT="${JAVA_OPT_EXT}" \
    TIME_ZONE="Asia/Shanghai"

WORKDIR $BASE_DIR

ADD ./target/$CAMPUS_CARD_SERVICE_PACKAGE target/$CAMPUS_CARD_SERVICE_PROGRAM
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone

ADD bin/docker-startup.sh bin/docker-startup.sh
ADD conf/bootstrap.yml conf/bootstrap.yml
ADD conf/logback.xml conf/logback.xml
RUN mkdir -p init.d

# set startup log dir
RUN mkdir -p logs \
        && cd logs \
        && touch start.out \
        && ln -sf /dev/stdout start.out \
        && ln -sf /dev/stderr start.out
RUN chmod +x bin/docker-startup.sh

EXPOSE 4080

CMD ls -l
